﻿#include "UIPlayModel.h"
#include "PlayerOnQMediaBL.h"
#include "Utils/GloabTool/FuncTools.h"
#include <QDebug>

UIPlayModel::UIPlayModel(QObject *parent)
    : UIModelBase{parent}
{
    BL_Player = new PlayerOnQMediaBL();
    
    qout << __FUNCTION__ << BL_Player;
}

void UIPlayModel::setEngine(QP::PlayEngine type)
{
    BL_Player->setEngine(type);
    
}

QP::PlayEngine UIPlayModel::Engine()
{
    return BL_Player->Engine();
}

void UIPlayModel::setMedia(const QUrl &url)
{
    BL_Player->open(url.toString());
}

void UIPlayModel::Play()
{
    BL_Player->play();
}

void UIPlayModel::Pause()
{
    BL_Player->pause();
}

void UIPlayModel::Stop()
{
    BL_Player->stop();
}

QP::PlaybackState UIPlayModel::state()
{
    return BL_Player->state();
}

PlayerOnQMediaBL *UIPlayModel::getPlayer()
{
    return this->BL_Player;
}

void UIPlayModel::setVideoWidget(QObject *w)
{
    BL_Player->setVideoWidget(w);
}
